<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ page import="java.util.*,
						com.ophelisis.common.util.*,
						com.ophelisis.common.consts.*,
						com.ophelisis.actions.system.*"%>
						
<script src="js/jquery.blockUI.js"></script>
<script>
$(document).ready(function() {
	getResult();
});

function getResult() {
	var resultMessageLocal = $("#resultMessageLocal");
	var resultMessageForm = $("#formProcess").contents().find("#resultMessageForm");
	var resultReturn = "";
	
	var msg = "";
	var url = "";

	if (resultMessageLocal.length > 0 && resultMessageLocal.val() != "") {
		msg = resultMessageLocal.val();
		
		resultReturn = $("#resultReturnLocal");
		if (resultReturn.length > 0 && resultReturn.val() != "") {
			url = resultReturn.val();
		}
	}
	
	if (resultMessageForm.length > 0 && resultMessageForm.val() != "") {
		msg = resultMessageForm.val();
		resultMessageForm.val("");
		
		resultReturn = $("#resultReturnForm");
		if (resultReturn.length > 0 && resultReturn.val() != "") {
			url = resultReturn.val();
		}
	}
	
	if (msg != "") {
		loadMessage(msg, url);
	}
}

function loadMessage(msg, url) {
	var opt = {
			message:"<div class='box_block_top'><div class='bl'></div><div class='bc'></div><div class='br'></div></div><div class='box_block_mid'><div class='msg' style='border:solid 2px #ccc; padding:3px;'><div style='font-weight:bold;' class='subject'>" + msg + "</div></div></div><div class='box_block_btm'><div class='bl'></div><div class='bc'></div><div class='br'></div></div>",
			css:{"border-width":"0", "background":"transparent", cursor:null},
			centerY: true
			, timeout:500
			, onUnblock:function() {
				if (url != "") {
					parent.location.replace(url);
				}
			}
	};
	parent.$.blockUI(opt);
	parent.$('#return_close').click(function(){parent.$.unblockUI();});
}
</script>

<input type="hidden" id="resultReturnLocal" name="resultReturnLocal" value="${url}" />
<input type="hidden" id="resultMessageLocal" name="resultMessageLocal" value="${result}" />
